function modelGMM = doModelforGMM(model)

% Output for controls:
% log(hours), wage, dc, infl, r, r4,r12,r20,r28,r40
modelGMM   = model;
pos_l      = find(strcmp(model.labely,'$l_t$'));
pos_w      = find(strcmp(model.labely,'$w_t$'));
pos_dc     = find(strcmp(model.labely,'$dc_t$'));
pos_pai    = find(strcmp(model.labely,'$\pi_t$'));
tmpPos     = [pos_l,pos_w, pos_dc, pos_pai];
maturities = model.maturities;
idx_yields = (length(tmpPos)+1):length(tmpPos)+length(maturities(1:end));
nyGMM      = idx_yields(end);
nx         = model.nx;
% Allocating memory
modelGMM.g0   = zeros(nyGMM,1);
modelGMM.gx   = zeros(nyGMM,nx);
modelGMM.gxx  = zeros(nyGMM,nx,nx);
modelGMM.gxxx = zeros(nyGMM,nx,nx,nx);
modelGMM.gss  = zeros(nyGMM,1);
modelGMM.gssx = zeros(nyGMM,nx);
modelGMM.gsss = zeros(nyGMM,1);
modelGMM.ny   = nyGMM;
% Scaling of inflation
scaling       = [1 1 4 4]'; 
ii            = 1:length(tmpPos);
modelGMM.g0(ii,1)       = scaling.*model.g0(tmpPos,1);
modelGMM.gx(ii,:)       = scaling.*model.gx(tmpPos,:);
modelGMM.gxx(ii,:,:)    = scaling.*model.gxx(tmpPos,:,:);
modelGMM.gxxx(ii,:,:,:) = scaling.*model.gxxx(tmpPos,:,:,:);
modelGMM.gss(ii,1)      = scaling.*model.gss(tmpPos,1);
modelGMM.gssx(ii,:)     = scaling.*model.gssx(tmpPos,:);

% Level of yield curve
modelGMM.g0(idx_yields,1)       = 4*model.by0(maturities(1:end),1);
modelGMM.gx(idx_yields,:)       = 4*model.byx(maturities(1:end),:);
modelGMM.gxx(idx_yields,:,:)    = 4*reshape(model.byxx(maturities(1:end),:,:),length(maturities(1:end)),nx,nx);
modelGMM.gxxx(idx_yields,:,:,:) = 4*reshape(model.byxxx(maturities(1:end),:,:),length(maturities(1:end)),nx,nx,nx);
modelGMM.gss(idx_yields,1)      = 4*model.byss(maturities(1:end),1);
modelGMM.gssx(idx_yields,:)     = 4*model.byssx(maturities(1:end),:);
labelYields = cell(1,length(maturities));
for i=1:length(maturities)
    labelYields{i} = ['$y',num2str(maturities(1,i)),'_t$'];
end
modelGMM.labely                 = [model.labely(tmpPos) labelYields];

end